
public  class ParameterPassing {
		
	public static void main(String[] args) {
			ParameterPassing parameterPassing = new ParameterPassing();
//			System.out.println(parameterPassing.calcPrice(2, 4));
			
			int i=2,j=4;
			
//			Passing primitive Data value
			int k= parameterPassing.calcPrice(i, j);
			System.out.println(parameterPassing.calcPrice(i, j));
			System.out.println("i="+i +"  , j="+ j);
			
			//passing Object Reference values	
			Person person = new Person();
			person.name="mahi";
			Person tempPerson=  parameterPassing.calcPrice(person);

			System.out.println("Temp Person name = "+tempPerson.name);
			System.out.println("Original Person name "+person.name);
			
			//Passing Array references
			int[]  array1 = {2,4,6,8};
			System.out.println(array1[0] +"  ----------- "+array1[1]);
			int out = parameterPassing.calcPrice(array1);
			System.out.println(array1[0] +"  ============ "+array1[1]);
			
			//Passing Array elements as primitive object references
			int[]  array2 = {2,4,6,8};
			System.out.println(parameterPassing.calcPrice(array2[0]));
			System.out.println(array2[0]);
			
			
			Person[] personArray = {new Person("mahi"), new Person("adnan"), new Person("debashis")};
			System.out.println("================");
			System.out.println(personArray[0]);
			System.out.println(personArray[1]);
			
			System.out.println("================");
			parameterPassing.doOperation(personArray);
			System.out.println(personArray[0]);
			System.out.println(personArray[1]);
			
			
			Person[] personArray1 = {new Person("mahi"), new Person("adnan"), new Person("debashis")};
			System.out.println("***********************");
			System.out.println(personArray1[0].name);
			parameterPassing.test(personArray1[0]);
			System.out.println(personArray1[0].name);
			
			
			final Person person4;
			person4 =  new Person("mahi"); 
			
			final int r  = 2;
//			r=r+2;
			final Person person3 = new Person("mahi");  //1278
			//person3 = null;			//7892
			person3.name= "kalpana";
			
			
	}
	
	
	//Passing Array elements as  object references
	void test(Person j)
	{	
		j.name = "yahoo";
		
	}
	
	
	//Passing Array elements as primitive object references
	int calcPrice(int j)
	{	
		j=j+3;
		System.out.println(j);
		return j+1;
	}

	
	
	
	
	
	//Passing Array references
	void doOperation(Person[] testArray){
	
		testArray[0] = null;
	}

	
	
	
	//Passing Array references
		long calcPrice( int test, int[] array)
		{	
			return 0;	
		}
				
		
	
	//Passing Array references
	Person calcPrice(int[] test, int k)
	{	
		return null;	
	}
			
			
	//Passing Array references
		int calcPrice(int[] test)
		{	
			test[0] = 0;
			test[1] = 0;
			System.out.println(test[0] +" ^^^^^^^^^^^^^ "+test[1]);
			return test[0] + test[1] + test[2] + test[3];
		}

	//passing primitive data value
		int calcPrice(int i, int j){
			i=i+1;   //3
			j=j-1;   //3
			int k = i * j;
			System.out.println("inside i="+i +"  , j="+ j);
			
			return k;
		}
	
	//passing Object Reference values
	Person calcPrice(Person person){
		System.out.println("1 "+person.name);
		person.name = "test";
		System.out.println("2 "+person.name);
		return person;
				
	}
	
	
	//another example
		void changeName(final Person person){
//			person = null;
			System.out.println("1 "+person.name);
			person.name = "test";
			System.out.println("2 "+person.name);
			
					
		}
	
	//Poly morphism
	//many  
	
	//method overloading
	
	//signature = method name and method arguments
	//

}


